package com.qingfeng.medical.controller.front.hosp;

import com.qingfeng.medical.base.controller.BaseController;
import com.qingfeng.medical.base.log.annotation.Log;
import com.qingfeng.medical.base.log.enums.BusinessType;
import com.qingfeng.medical.base.result.Result;
import com.qingfeng.medical.biz.hosp.domain.entity.HospDepartment;
import com.qingfeng.medical.biz.hosp.domain.vo.HospDepartmentApiVo;
import com.qingfeng.medical.biz.hosp.service.HospDepartmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 科室管理
 *
 * @author 清风学Java
 * @date 2023-04-08 23:43:31
 */
@Api(tags = "科室管理管理")
@RestController
@RequestMapping("/api/hosp/hospDepartment")
@Validated
public class HospDepartmentApiController extends BaseController {

    @Autowired
    private HospDepartmentService hospDepartmentService;

    @ApiOperation(value = "科室-门诊管理列表", notes = "科室-门诊管理列表")
    @GetMapping("/list")
    @Log(title = "科室管理", businessType = BusinessType.SELECT, message = "科室-门诊管理列表")
    public Result<List<HospDepartmentApiVo>> list() {
        List<HospDepartmentApiVo> hospDepartmentApiVoList = hospDepartmentService.hospDepartmentApiList();
        return Result.ok(hospDepartmentApiVoList);
    }

    @ApiOperation(value = "根据Id查询科室门诊信息", notes = "根据Id查询科室门诊信息")
    @GetMapping("/dep/patient/{depId}")
    @Log(title = "科室管理", businessType = BusinessType.SELECT, message = "根据Id查询科室门诊信息")
    public Result<HospDepartment> findDepPatient(@PathVariable("depId") Long depId) {
        return Result.ok(hospDepartmentService.getById(depId));
    }
}
